package com.xiaocg.flyweight;

import java.util.HashMap;
import java.util.Map;

public class BoxFactory {
    private Map<String,AbstractBox> map = new HashMap<>();

    private BoxFactory(){
        map.put("i",new IBox());
        map.put("l",new LBox());
        map.put("o",new OBox());
    }

    public AbstractBox getBox(String name){
        return map.get(name);
    }

    private static BoxFactory factory = new BoxFactory();

    public static BoxFactory getInstance(){
        return factory;
    }

}
